using Godot;
using System;

namespace EnemyStateNode
{
public partial class Fall : Node,StateNode
{
	public Enemy enemy;

    public override void _Ready()
	{
		enemy = GetNode<Enemy>("/root/Main/Enemy");
	}
	
	public void OnEnter()
    {
        enemy.GetNode<AnimatedSprite2D>("AnimaEnemy").Animation="fall";
    }

    public void OnExit(){}    

    public void OnUpdate(float delta)
    {
        if(enemy.Health<=0)
			enemy.SwitchTo("Dead");
		else if(enemy.IsOnFloor())
			enemy.SwitchTo("Idle");
    }
}

}